<?php
/**
 * Base form class for the EventICms.
 *
 */
class EICms_Form extends Zend_Dojo_Form  {
		
	public function __construct($options = null) {
		
		parent::__construct($options);
		
		$this->setAttrib('accept-charset',Bootstrap::$registry->config->bootstrap->text_encoding);
		$this->setDecorators(array('FormElements','Form'));
		$this->setMethod('post');
	}
	
	/**
	 * Sets the forms action (prepended with the config directive base_domain and base_url if not set already).
	 *
	 * @param string $action
	 */
	public function setAction($action) {
		if(!empty(Bootstrap::$registry->config->bootstrap->base_domain) &&
			strpos($action,Bootstrap::$registry->config->bootstrap->base_domain) === FALSE) {
				$prepAction = Bootstrap::$registry->config->bootstrap->base_domain;
				if(!empty(Bootstrap::$registry->config->bootstrap->base_url) &&
				strpos($action,Bootstrap::$registry->config->bootstrap->base_url) === FALSE) {
					$prepAction .= Bootstrap::$registry->config->bootstrap->base_url;
				}
			$action = $prepAction . $action;
		}
		parent::setAction($action);
	}
}
?>